varying vec2 vUv;
varying float vAngle;

uniform vec3 uColor;
uniform vec3 uColorBg;
uniform float uTime;
uniform float uSpeed;
uniform sampler2D uNoiseTexture;
uniform float uColorBgAlphe;
uniform float uPercent;

void main(){
    //计算范围
    float newPercent = 1.0 / uPercent;
    float progress = mod(- vAngle * newPercent + 1.0 - uTime * uSpeed * newPercent / 8.0, newPercent) - (newPercent - 1.0);
    vec4 noiseColor = texture2D(uNoiseTexture, vUv);
    //判断是网还是格1为网2为格
    float isNet = step(0.02, noiseColor.r);
    vec3 mixColor = mix(uColorBg, uColor, isNet);
    float mixAlphe = mix(uColorBgAlphe, 1.0, isNet);
    gl_FragColor = progress * vec4(mixColor, mixAlphe);
}